﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Orchard.Environment.Extensions;
using Downplay.Audit.Services;

namespace Downplay.Audit.Controllers
{

    /// <summary>
    /// This logger is used for returning a client message when a piece of media has been viewed
    /// </summary>
    public class AuditController : Controller
    {
        private readonly IAuditService _auditService;

        public AuditController(IAuditService auditService)
        {
            _auditService = auditService;
        }

        [HttpGet]
        public ActionResult Complete(int id)
        {
            return this.Json(_auditService.CompleteAudit(id), JsonRequestBehavior.AllowGet);
        }

        /// <summary>
        /// Update an Audit record with new data
        /// TODO: Should this (and Complete) be POST to avoid potential (if unlikely) hacking?
        /// </summary>
        /// <param name="id"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        /* [HttpGet]
        public ActionResult Update(int id, string data) {

        }*/
    }
}